<?php

class Authorization extends Eloquent
{
    protected $table = 'authorization';

    protected $fillable = array('id', 'username', 'password');

    public function createOrUpdate(array $data)
    {
        $id = $data['id'];

        $exists = $this->find($id);

        if (! $exists) {
            return $this->create($data);
        }

        return $this->where('id', '=', $id)->update($data);
    }
}